inherited frmAbonentsMeters: TfrmAbonentsMeters
  Left = 429
  Top = 198
  Caption = #1047#1072#1085#1077#1089#1077#1085#1080#1077' '#1087#1086#1082#1072#1079#1072#1085#1080#1081' '#1080#1085#1076#1080#1074#1080#1076#1091#1072#1083#1100#1085#1099#1093' '#1089#1095#1077#1090#1095#1080#1082#1086#1074
  OldCreateOrder = True
  OnShow = FormShow
  PixelsPerInch = 96
  TextHeight = 13
  inherited Panel1: TPanel
    inherited BitBtn1: TBitBtn
      Left = 592
      Top = 2
    end
    inherited BitBtn2: TBitBtn
      Left = 694
      Top = 2
    end
  end
  inherited ToolBar1: TToolBar
    Top = 110
    Height = 0
  end
  object Panel2: TPanel [2]
    Left = 0
    Top = 0
    Width = 792
    Height = 110
    Align = alTop
    BevelOuter = bvNone
    TabOrder = 2
    object GroupBox1: TGroupBox
      Left = 0
      Top = 53
      Width = 792
      Height = 53
      Align = alTop
      Caption = ' '#1059#1089#1083#1091#1075#1072' '
      TabOrder = 0
      object lcbServices: TDBLookupComboboxEh
        Left = 20
        Top = 20
        Width = 349
        Height = 19
        AlwaysShowBorder = True
        EditButtons = <>
        Flat = True
        KeyField = 'ID'
        ListField = 'NAME'
        ListSource = dsc_Services
        TabOrder = 0
        Visible = True
      end
      object bSearch: TButton
        Left = 376
        Top = 20
        Width = 75
        Height = 19
        Caption = #1055#1086#1080#1089#1082
        TabOrder = 1
        OnClick = bSearchClick
      end
    end
    object GroupBox2: TGroupBox
      Left = 0
      Top = 0
      Width = 792
      Height = 53
      Align = alTop
      Caption = ' '#1040#1076#1088#1077#1089' '
      TabOrder = 1
      DesignSize = (
        792
        53)
      object DBEditEh2: TDBEditEh
        Left = 20
        Top = 20
        Width = 753
        Height = 19
        AlwaysShowBorder = True
        Anchors = [akLeft, akTop, akRight]
        Color = clBtnFace
        DataField = 'ADDRESS'
        DataSource = dsc_BuildInfo
        EditButtons = <>
        Flat = True
        ReadOnly = True
        TabOrder = 0
        Visible = True
      end
    end
  end
  object dbg_AbonentsMeters: TDBGridEh [3]
    Left = 0
    Top = 110
    Width = 792
    Height = 436
    Align = alClient
    DataSource = dsc_AbonentsMeters
    Flat = True
    FooterColor = clWindow
    FooterFont.Charset = DEFAULT_CHARSET
    FooterFont.Color = clWindowText
    FooterFont.Height = -11
    FooterFont.Name = 'MS Sans Serif'
    FooterFont.Style = []
    Options = [dgTitles, dgColumnResize, dgColLines, dgRowLines, dgTabs, dgRowSelect, dgConfirmDelete, dgCancelOnExit]
    OptionsEh = [dghFixed3D, dghHighlightFocus, dghClearSelection, dghDblClickOptimizeColWidth, dghDialogFind]
    TabOrder = 3
    TitleFont.Charset = DEFAULT_CHARSET
    TitleFont.Color = clWindowText
    TitleFont.Height = -11
    TitleFont.Name = 'MS Sans Serif'
    TitleFont.Style = []
    UseMultiTitle = True
    VTitleMargin = 5
    OnDblClick = dbg_AbonentsMetersDblClick
    Columns = <
      item
        EditButtons = <>
        FieldName = 'ADDRESS'
        Footers = <>
      end
      item
        EditButtons = <>
        FieldName = 'LASTCHARGEDATE'
        Footers = <>
      end>
  end
  inherited ActionList1: TActionList
    Left = 672
    Top = 68
  end
  inherited PropStorage: TPropStorageEh
    Section = 'frmAbonMeters'
    StoredProps.Strings = (
      '<P>.Height'
      '<P>.Left'
      '<P>.PixelsPerInch'
      '<P>.Top'
      '<P>.Width'
      '<P>.WindowState'
      'dbg_AbonentsMeters.<P>.Columns.ColumnsIndex'
      'dbg_AbonentsMeters.<P>.Columns.<ForAllItems>.Width')
  end
  object LocalTrans: TpFIBTransaction
    DefaultDatabase = MAINDM.pMainDatabase
    TimeoutAction = TARollback
    Left = 672
    Top = 28
  end
  object ds_AbonentsMeters: TpFIBDataSet
    SelectSQL.Strings = (
      'select v.id, v.address, d.id as dogovor_id,'
      '       max((select max(p.docdate) from pays p, vw_traits vw'
      '        where p.dogovor_id = d.id and p.p_type = vw.p_type'
      
        '          and vw.code = '#39'CHARGE'#39' and p.docno starting '#39'C'#39')) as l' +
        'astchargedate'
      ''
      '  from v_abons v, dogovors d, services s'
      '  where v.building_id = :pbuilding_id'
      
        '    and not exists (select 1 from abonents a where a.super_abone' +
        'nt = v.id)'
      '    and v.id = d.abonent_id'
      '    and d.service_id = s.id'
      '    and d.is_active = 1'
      '    and s.group_id = :pgroup_id'
      
        '    and exists (select 1 from proc_dogovor_meter_exist (d.id, cu' +
        'rrent_date, null, null) p'
      '          where p.rmeter_exist = 1)'
      '  group by 1,2,3'
      '  order by 2')
    Transaction = LocalTrans
    Database = MAINDM.pMainDatabase
    Left = 708
    Top = 68
    object ds_AbonentsMetersID: TFIBIntegerField
      FieldName = 'ID'
    end
    object ds_AbonentsMetersADDRESS: TFIBStringField
      DisplayLabel = #1040#1076#1088#1077#1089
      DisplayWidth = 100
      FieldName = 'ADDRESS'
      Size = 245
      EmptyStrToNull = True
    end
    object ds_AbonentsMetersDOGOVOR_ID: TFIBIntegerField
      FieldName = 'DOGOVOR_ID'
    end
    object ds_AbonentsMetersLASTCHARGEDATE: TFIBDateField
      DisplayLabel = #1044#1072#1090#1072' '#1087#1086#1089#1083#1077#1076#1085#1077#1075#1086' '#1085#1072#1095#1080#1089#1083#1077#1085#1080#1103
      DisplayWidth = 20
      FieldName = 'LASTCHARGEDATE'
    end
  end
  object dsc_AbonentsMeters: TDataSource
    DataSet = ds_AbonentsMeters
    Left = 740
    Top = 68
  end
  object ds_BuildInfo: TpFIBDataSet
    SelectSQL.Strings = (
      'select v.address'
      '  from v_abons v'
      '  where v.id = :pabonent_id')
    Transaction = LocalTrans
    Database = MAINDM.pMainDatabase
    Left = 708
    Top = 28
    object ds_BuildInfoADDRESS: TFIBStringField
      FieldName = 'ADDRESS'
      Size = 245
      EmptyStrToNull = True
    end
  end
  object dsc_BuildInfo: TDataSource
    DataSet = ds_BuildInfo
    Left = 740
    Top = 28
  end
  object ds_Services: TpFIBDataSet
    SelectSQL.Strings = (
      'select s.id, s.name'
      '  from services s, vw_straits v'
      '  where s.group_id = 0'
      '    and v.service_id = s.id'
      '    and v.code = '#39'CAN_METER'#39
      '  order by 2')
    Transaction = LocalTrans
    Database = MAINDM.pMainDatabase
    Left = 708
    Top = 104
    object ds_ServicesID: TFIBIntegerField
      FieldName = 'ID'
    end
    object ds_ServicesNAME: TFIBStringField
      FieldName = 'NAME'
      Size = 120
      EmptyStrToNull = True
    end
  end
  object dsc_Services: TDataSource
    DataSet = ds_Services
    Left = 740
    Top = 104
  end
end
